home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ZED3DSRC.ZIP / ZSORT.H < prev   
C/C++ Source or Header  |  1995-06-19  |  2KB  |  84 lines

  1. #ifndef __ZSORT_H
  2. #define __ZSORT_H
  3.  
  4. #include <objects.h>
  5.  
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9.  
  10.  
  11.  
  12. struct pipe_point_struct
  13.     {
  14.     point point;
  15.     REAL scr_X,scr_Y;
  16.     };
  17.  
  18.  
  19. typedef struct pipe_point_struct pipe_point;
  20.  
  21.  
  22.  
  23.  
  24. /* Z sorting routines for visible surface determination */
  25.  
  26. struct pipeline_struct
  27.     {
  28.     pipe_point *pbase;
  29.     face *fbase;
  30.     long *ibase;
  31.     long pptr,fptr,iptr;
  32.     long numfaces, numpoints, numindex;
  33.     long *index1, *index2, *maxZ, *minZ; /* sorting data */
  34.     };
  35.  
  36.  
  37.  
  38. typedef struct pipeline_struct pipeline;
  39.  
  40.  
  41. pipeline *alloc_pipeline(int numpoints, int numfaces, int numindex);
  42.     /* allocates a pipeline and calls reset_pipeline */
  43.  
  44. void free_pipeline(pipeline *p);
  45.     /* frees a pipeline */
  46.  
  47. void reset_pipeline(pipeline *p);
  48.     /* empties the pipeline */
  49.  
  50.  
  51. long *sort_pipeline(pipeline *p);
  52.     /* z-sorts the pipeline and puts the result in one of the indexes,
  53.        returns pointer to index to sorted faces. */
  54.  
  55. void xform_pointcollection
  56.     (pointcollection *p,
  57.      affine *xform,
  58.      pipe_point *xpoints);
  59.     /* transforms a given pointcollection's points using the orientation
  60.        matrix and position vector (e.g. multiplies by rotation matrix then
  61.        adds position vector. points are outputted to the xpoints array */
  62.  
  63. void cull_object(object *o, pipeline *p, affine *xform);
  64.     /* culls the object and outputs only the needed faces to the pipeline.
  65.        also performs the xform_pointcollection and stuff */
  66.  
  67.  
  68.  
  69. void bytesort(long *data, long *indexin, long *indexout, long itemcount,
  70.             int bytenumber);
  71.     /* for bytenumber values of 0 to 3, sorts the data according to
  72.        bytenumber in increasing values. Data is input in order of indexin
  73.        and output in order of indexout - note: this sort uses a temporary
  74.        array internally, allocated on the stack of course, of size
  75.        257*sizeof(long), so don't run this with a tiny weensy little stack */
  76.  
  77.  
  78.  
  79.  
  80. #ifdef __cplusplus
  81. }
  82. #endif
  83.  
  84. #endif